﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using Module_Persistence;
using Module_Basic_Entities;

namespace ContentPipelineExtension_MapFromMappy
{
    class TileCustomContentTypeWriter : ContentTypeWriter
    {
        public TileCustomContentTypeWriter(Type targetType)
            : base(targetType)
        {
            
        }

        public override string GetRuntimeReader(Microsoft.Xna.Framework.TargetPlatform targetPlatform)
        {
            return "Module_Persistence.Tile, Module_Persistence";
        }

        protected override void Write(ContentWriter output, object value)
        {
            if (value == null)
            {
                throw new Exception("Null Exception");
            }

            Tile tile = (Tile)value;

            output.Write(tile.Walkable);
            output.Write(tile.Id);
            output.Write(tile.Width);
            output.Write(tile.Height);            
        }        
    }
}
